package com.aaa.mapper;

import com.aaa.pojos.Emp;
import com.aaa.pojos.EmpGender;
import com.aaa.pojos.EmpJob;
import com.aaa.pojos.PackBean;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDate;
import java.util.List;

@Mapper
public interface EmpMapper {

//        没用PageHelper插件做法
//    int count(String name, Integer gender, LocalDate begin, LocalDate end);
//    List<Emp> pageQuery(String name, Integer gender, LocalDate begin, LocalDate end, int index, int pageSize);


    List<Emp> page(String name, Integer gender, LocalDate begin, LocalDate end);

    @Options()
    void addEmp(Emp emp);

    List<Emp> jobName();

    void deleteId(Integer[] ids);

    Emp selectId(int id);

    void update(Emp emp);
//    @Select("select case job " +
//            "when 1 then '班主任' " +
//            "when 2 then '讲师' " +
//            "when 3 then '学工主管' " +
//            "when 4 then '教研主管' " +
//            "when 5 then '咨询师' " +
//            "else '其他' end as job, " +
//            "count(*) cnt from emp group by job")
    List<EmpJob> selectJobCnt();

    List<EmpGender> empGender();

    @Select("select * from emp where username = #{username} and password =#{password}")
    Emp empLog(Emp emp);
}
